*************************************************************************************************************************************************************
*************************************************************************************************************************************************************
***This .do file generates Estimates_for_plots_label.dta, which is used for the generation of those plots in the paper, which deal with the three subsidized
*labels in Hungary******************************************************************************************************************************************
***Do not split the file: files names over-ride each other, and estimates for all programs should be saved sequentially**************************************
*************************************************************************************************************************************************************
*************************************************************************************************************************************************************




clear all

use "Estimation Sample.dta" 
*log using "R:\WSV2\TBu_BMa\Subsidies Project\Results\Estimates_for_plots_labels.smcl", replace
set more off

xtset id2




 encode energy_label_eu, gen(label)


preserve	
	
egen cmt=group(country month treath)
egen cmlt=group(country month energy_label_eu treath)
label list label


***HUNGARY, 2015, UNIT SALES, SUBSIDIZED, LABEL A+++
quietly reghdfe dlogunits  i.presub3h##ib1.treath##ib4.label i.presub2h##ib1.treath##ib4.label i.presub1h##ib1.treath##ib4.label i.sub1h##ib1.treath##ib4.label i.sub2h##ib1.treath##ib4.label i.sub3h##ib1.treath##ib4.label i.sub4h##ib1.treath##ib4.label i.postsub1h##ib1.treath##ib4.label i.postsub2h##ib1.treath##ib4.label i.postsub3h##ib1.treath##ib4.label mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)
est store subu3


		nlcom _b[1.presub3h], post
		est store s1
		parmest, format(estimate min95 max95) saving("s1.dta", replace) 	idstr(-3)	
		
est restore subu3
		nlcom _b[1.presub3h]+_b[1.presub2h], post
		est store s2
		parmest, format(estimate min95 max95) saving("s2.dta", replace) 	idstr(-2)
		
est restore subu3
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h], post
		est store s3
		parmest, format(estimate min95 max95) saving("s3.dta", replace) 	idstr(-1)	
		
est restore subu3
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h], post
		est store s4
		parmest, format(estimate min95 max95) saving("s4.dta", replace) 	idstr(0)	
		
est restore subu3
		nlcom  _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h], post
		est store s5
		parmest, format(estimate min95 max95) saving("s5.dta", replace) 	idstr(1)		
		
est restore subu3
		nlcom  _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h], post
		est store s6
		parmest, format(estimate min95 max95) saving("s6.dta", replace) 	idstr(2)		

est restore subu3
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h], post
		est store s7
		parmest, format(estimate min95 max95) saving("s7.dta", replace) 	idstr(3)

est restore subu3
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h], post
		est store s8
		parmest, format(estimate min95 max95) saving("s8.dta", replace) 	idstr(4)		
	
est restore subu3
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h]+_b[1.postsub2h], post
		est store s9
		parmest, format(estimate min95 max95) saving("s9.dta", replace) 	idstr(5)		
	
est restore subu3
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h]+_b[1.postsub2h]+_b[1.postsub3h], post
		est store s10
		parmest, format(estimate min95 max95) saving("s10.dta", replace) 	idstr(6)			
	

	clear all
		
		use "s1.dta"
		append using "s2.dta"
		append using "s3.dta"
		append using "s4.dta"
		append using "s5.dta"
		append using "s6.dta"
		append using "s7.dta"
		append using "s8.dta"
		append using "s9.dta"
		append using "s10.dta"
	
		gen type="s"
		gen label="a3"
		drop z p parm
		rename idstr month
		save "s_3.dta", replace
	
restore	

preserve

egen cmt=group(country month treath)
egen cmlt=group(country month energy_label_eu treath)
label list label


***HUNGARY, 2015, UNIT SALES, SUBSIDIZED, LABEL A++


quietly reghdfe dlogunits i.presub3h##ib1.treath##ib3.label i.presub2h##ib1.treath##ib3.label i.presub1h##ib1.treath##ib3.label i.sub1h##ib1.treath##ib3.label i.sub2h##ib1.treath##ib3.label i.sub3h##ib1.treath##ib3.label i.sub4h##ib1.treath##ib3.label i.postsub1h##ib1.treath##ib3.label i.postsub2h##ib1.treath##ib3.label i.postsub3h##ib1.treath##ib3.label mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)
est store subu2

		nlcom _b[1.presub3h], post
		est store s1
		parmest, format(estimate min95 max95) saving("s1.dta", replace) 	idstr(-3)	
		
est restore subu2
		nlcom _b[1.presub3h]+_b[1.presub2h], post
		est store s2
		parmest, format(estimate min95 max95) saving("s2.dta", replace) 	idstr(-2)
		
est restore subu2
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h], post
		est store s3
		parmest, format(estimate min95 max95) saving("s3.dta", replace) 	idstr(-1)	
		
est restore subu2
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h], post
		est store s4
		parmest, format(estimate min95 max95) saving("s4.dta", replace) 	idstr(0)	
		
est restore subu2
		nlcom  _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h], post
		est store s5
		parmest, format(estimate min95 max95) saving("s5.dta", replace) 	idstr(1)		
		
est restore subu2
		nlcom  _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h], post
		est store s6
		parmest, format(estimate min95 max95) saving("s6.dta", replace) 	idstr(2)		

est restore subu2
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h], post
		est store s7
		parmest, format(estimate min95 max95) saving("s7.dta", replace) 	idstr(3)

est restore subu2
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h], post
		est store s8
		parmest, format(estimate min95 max95) saving("s8.dta", replace) 	idstr(4)		
	
est restore subu2
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h]+_b[1.postsub2h], post
		est store s9
		parmest, format(estimate min95 max95) saving("s9.dta", replace) 	idstr(5)		
	
est restore subu2
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h]+_b[1.postsub2h]+_b[1.postsub3h], post
		est store s10
		parmest, format(estimate min95 max95) saving("s10.dta", replace) 	idstr(6)			
	

	clear all
		
		use "s1.dta"
		append using "s2.dta"
		append using "s3.dta"
		append using "s4.dta"
		append using "s5.dta"
		append using "s6.dta"
		append using "s7.dta"
		append using "s8.dta"
		append using "s9.dta"
		append using "s10.dta"
	
		gen type="s"
		gen label="a2"
		drop z p parm
		rename idstr month
		save "s_2.dta", replace
	
restore	

preserve	
	
egen cmt=group(country month treath)
egen cmlt=group(country month energy_label_eu treath)
label list label


***HUNGARY, 2015, UNIT SALES, SUBSIDIZED, LABEL A+

quietly reghdfe dlogunits i.presub3h##ib1.treath##ib2.label i.presub2h##ib1.treath##ib2.label i.presub1h##ib1.treath##ib2.label i.sub1h##ib1.treath##ib2.label i.sub2h##ib1.treath##ib2.label i.sub3h##ib1.treath##ib2.label i.sub4h##ib1.treath##ib2.label i.postsub1h##ib1.treath##ib2.label i.postsub2h##ib1.treath##ib2.label i.postsub3h##ib1.treath##ib2.label mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)
est store subu1


		nlcom _b[1.presub3h], post
		est store s1
		parmest, format(estimate min95 max95) saving("s1.dta", replace) 	idstr(-3)	
		
est restore subu1
		nlcom _b[1.presub3h]+_b[1.presub2h], post
		est store s2
		parmest, format(estimate min95 max95) saving("s2.dta", replace) 	idstr(-2)
		
est restore subu1
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h], post
		est store s3
		parmest, format(estimate min95 max95) saving("s3.dta", replace) 	idstr(-1)	
		
est restore subu1
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h], post
		est store s4
		parmest, format(estimate min95 max95) saving("s4.dta", replace) 	idstr(0)	
		
est restore subu1
		nlcom  _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h], post
		est store s5
		parmest, format(estimate min95 max95) saving("s5.dta", replace) 	idstr(1)		
		
est restore subu1
		nlcom  _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h], post
		est store s6
		parmest, format(estimate min95 max95) saving("s6.dta", replace) 	idstr(2)		

est restore subu1
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h], post
		est store s7
		parmest, format(estimate min95 max95) saving("s7.dta", replace) 	idstr(3)

est restore subu1
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h], post
		est store s8
		parmest, format(estimate min95 max95) saving("s8.dta", replace) 	idstr(4)		
	
est restore subu1
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h]+_b[1.postsub2h], post
		est store s9
		parmest, format(estimate min95 max95) saving("s9.dta", replace) 	idstr(5)		
	
est restore subu1
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h]+_b[1.postsub2h]+_b[1.postsub3h], post
		est store s10
		parmest, format(estimate min95 max95) saving("s10.dta", replace) 	idstr(6)			
	

	clear all
		
		use "s1.dta"
		append using "s2.dta"
		append using "s3.dta"
		append using "s4.dta"
		append using "s5.dta"
		append using "s6.dta"
		append using "s7.dta"
		append using "s8.dta"
		append using "s9.dta"
		append using "s10.dta"
	
		gen type="s"
		gen label="a1"
		drop z p parm
		rename idstr month
		save "s_1.dta", replace
	
restore	


preserve	
	
egen cmt=group(country month treath)
egen cmlt=group(country month energy_label_eu treath)
label list label


***HUNGARY, 2015, PRICES, SUBSIDIZED, LABEL A+++

quietly reghdfe dlogunits  i.presub2h##ib1.treath##ib4.label i.presub1h##ib1.treath##ib4.label i.sub1h##ib1.treath##ib4.label i.sub2h##ib1.treath##ib4.label i.sub3h##ib1.treath##ib4.label i.sub4h##ib1.treath##ib4.label i.postsub1h##ib1.treath##ib4.label i.postsub2h##ib1.treath##ib4.label  mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)
generate samplel=e(sample)
		
quietly reghdfe dlogprice i.presub3h##ib1.treath##ib4.label i.presub2h##ib1.treath##ib4.label i.presub1h##ib1.treath##ib4.label i.sub1h##ib1.treath##ib4.label i.sub2h##ib1.treath##ib4.label i.sub3h##ib1.treath##ib4.label i.sub4h##ib1.treath##ib4.label i.postsub1h##ib1.treath##ib4.label i.postsub2h##ib1.treath##ib4.label i.postsub3h##ib1.treath##ib4.label mage mage2  if country!="Croatia" & samplel, absorb(id2 cmlt) cluster(id)
est store subu3


		nlcom _b[1.presub3h], post
		est store s1
		parmest, format(estimate min95 max95) saving("s1.dta", replace) 	idstr(-3)	
		
est restore subu3
		nlcom _b[1.presub3h]+_b[1.presub2h], post
		est store s2
		parmest, format(estimate min95 max95) saving("s2.dta", replace) 	idstr(-2)
		
est restore subu3
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h], post
		est store s3
		parmest, format(estimate min95 max95) saving("s3.dta", replace) 	idstr(-1)	
		
est restore subu3
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h], post
		est store s4
		parmest, format(estimate min95 max95) saving("s4.dta", replace) 	idstr(0)	
		
est restore subu3
		nlcom  _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h], post
		est store s5
		parmest, format(estimate min95 max95) saving("s5.dta", replace) 	idstr(1)		
		
est restore subu3
		nlcom  _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h], post
		est store s6
		parmest, format(estimate min95 max95) saving("s6.dta", replace) 	idstr(2)		

est restore subu3
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h], post
		est store s7
		parmest, format(estimate min95 max95) saving("s7.dta", replace) 	idstr(3)

est restore subu3
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h], post
		est store s8
		parmest, format(estimate min95 max95) saving("s8.dta", replace) 	idstr(4)		
	
est restore subu3
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h]+_b[1.postsub2h], post
		est store s9
		parmest, format(estimate min95 max95) saving("s9.dta", replace) 	idstr(5)		
	
est restore subu3
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h]+_b[1.postsub2h]+_b[1.postsub3h], post
		est store s10
		parmest, format(estimate min95 max95) saving("s10.dta", replace) 	idstr(6)			
	

	clear all
		
		use "s1.dta"
		append using "s2.dta"
		append using "s3.dta"
		append using "s4.dta"
		append using "s5.dta"
		append using "s6.dta"
		append using "s7.dta"
		append using "s8.dta"
		append using "s9.dta"
		append using "s10.dta"
	
		gen type="sp"
		gen label="a3"
		drop z p parm
		rename idstr month
		save "s_3_p.dta", replace
	
restore	

preserve

egen cmt=group(country month treath)
egen cmlt=group(country month energy_label_eu treath)
label list label


***HUNGARY, 2015, PRICES, SUBSIDIZED, LABEL A++

quietly reghdfe dlogunits  i.presub2h##ib1.treath##ib4.label i.presub1h##ib1.treath##ib4.label i.sub1h##ib1.treath##ib4.label i.sub2h##ib1.treath##ib4.label i.sub3h##ib1.treath##ib4.label i.sub4h##ib1.treath##ib4.label i.postsub1h##ib1.treath##ib4.label i.postsub2h##ib1.treath##ib4.label  mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)
generate samplel=e(sample)


quietly reghdfe dlogprice i.presub3h##ib1.treath##ib3.label i.presub2h##ib1.treath##ib3.label i.presub1h##ib1.treath##ib3.label i.sub1h##ib1.treath##ib3.label i.sub2h##ib1.treath##ib3.label i.sub3h##ib1.treath##ib3.label i.sub4h##ib1.treath##ib3.label i.postsub1h##ib1.treath##ib3.label i.postsub2h##ib1.treath##ib3.label i.postsub3h##ib1.treath##ib3.label mage mage2  if country!="Croatia" & samplel, absorb(id2 cmlt) cluster(id)
est store subu2

		nlcom _b[1.presub3h], post
		est store s1
		parmest, format(estimate min95 max95) saving("s1.dta", replace) 	idstr(-3)	
		
est restore subu2
		nlcom _b[1.presub3h]+_b[1.presub2h], post
		est store s2
		parmest, format(estimate min95 max95) saving("s2.dta", replace) 	idstr(-2)
		
est restore subu2
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h], post
		est store s3
		parmest, format(estimate min95 max95) saving("s3.dta", replace) 	idstr(-1)	
		
est restore subu2
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h], post
		est store s4
		parmest, format(estimate min95 max95) saving("s4.dta", replace) 	idstr(0)	
		
est restore subu2
		nlcom  _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h], post
		est store s5
		parmest, format(estimate min95 max95) saving("s5.dta", replace) 	idstr(1)		
		
est restore subu2
		nlcom  _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h], post
		est store s6
		parmest, format(estimate min95 max95) saving("s6.dta", replace) 	idstr(2)		

est restore subu2
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h], post
		est store s7
		parmest, format(estimate min95 max95) saving("s7.dta", replace) 	idstr(3)

est restore subu2
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h], post
		est store s8
		parmest, format(estimate min95 max95) saving("s8.dta", replace) 	idstr(4)		
	
est restore subu2
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h]+_b[1.postsub2h], post
		est store s9
		parmest, format(estimate min95 max95) saving("s9.dta", replace) 	idstr(5)		
	
est restore subu2
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h]+_b[1.postsub2h]+_b[1.postsub3h], post
		est store s10
		parmest, format(estimate min95 max95) saving("s10.dta", replace) 	idstr(6)			
	

	clear all
		
		use "s1.dta"
		append using "s2.dta"
		append using "s3.dta"
		append using "s4.dta"
		append using "s5.dta"
		append using "s6.dta"
		append using "s7.dta"
		append using "s8.dta"
		append using "s9.dta"
		append using "s10.dta"
	
		gen type="sp"
		gen label="a2"
		drop z p parm
		rename idstr month
		save "s_2_p.dta", replace
	
restore	

preserve	
	
egen cmt=group(country month treath)
egen cmlt=group(country month energy_label_eu treath)
label list label


***HUNGARY, 2015, PRICES, SUBSIDIZED, LABEL A+

quietly reghdfe dlogunits  i.presub2h##ib1.treath##ib4.label i.presub1h##ib1.treath##ib4.label i.sub1h##ib1.treath##ib4.label i.sub2h##ib1.treath##ib4.label i.sub3h##ib1.treath##ib4.label i.sub4h##ib1.treath##ib4.label i.postsub1h##ib1.treath##ib4.label i.postsub2h##ib1.treath##ib4.label  mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)
generate samplel=e(sample)

quietly reghdfe dlogprice i.presub3h##ib1.treath##ib2.label i.presub2h##ib1.treath##ib2.label i.presub1h##ib1.treath##ib2.label i.sub1h##ib1.treath##ib2.label i.sub2h##ib1.treath##ib2.label i.sub3h##ib1.treath##ib2.label i.sub4h##ib1.treath##ib2.label i.postsub1h##ib1.treath##ib2.label i.postsub2h##ib1.treath##ib2.label i.postsub3h##ib1.treath##ib2.label mage mage2  if country!="Croatia" & samplel , absorb(id2 cmlt) cluster(id)
est store subu1


		nlcom _b[1.presub3h], post
		est store s1
		parmest, format(estimate min95 max95) saving("s1.dta", replace) 	idstr(-3)	
		
est restore subu1
		nlcom _b[1.presub3h]+_b[1.presub2h], post
		est store s2
		parmest, format(estimate min95 max95) saving("s2.dta", replace) 	idstr(-2)
		
est restore subu1
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h], post
		est store s3
		parmest, format(estimate min95 max95) saving("s3.dta", replace) 	idstr(-1)	
		
est restore subu1
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h], post
		est store s4
		parmest, format(estimate min95 max95) saving("s4.dta", replace) 	idstr(0)	
		
est restore subu1
		nlcom  _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h], post
		est store s5
		parmest, format(estimate min95 max95) saving("s5.dta", replace) 	idstr(1)		
		
est restore subu1
		nlcom  _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h], post
		est store s6
		parmest, format(estimate min95 max95) saving("s6.dta", replace) 	idstr(2)		

est restore subu1
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h], post
		est store s7
		parmest, format(estimate min95 max95) saving("s7.dta", replace) 	idstr(3)

est restore subu1
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h], post
		est store s8
		parmest, format(estimate min95 max95) saving("s8.dta", replace) 	idstr(4)		
	
est restore subu1
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h]+_b[1.postsub2h], post
		est store s9
		parmest, format(estimate min95 max95) saving("s9.dta", replace) 	idstr(5)		
	
est restore subu1
		nlcom _b[1.presub3h]+_b[1.presub2h]+_b[1.presub1h]+_b[1.sub1h]+_b[1.sub2h]+_b[1.sub3h]+_b[1.sub4h]+_b[1.postsub1h]+_b[1.postsub2h]+_b[1.postsub3h], post
		est store s10
		parmest, format(estimate min95 max95) saving("s10.dta", replace) 	idstr(6)			
	

	clear all
		
		use "s1.dta"
		append using "s2.dta"
		append using "s3.dta"
		append using "s4.dta"
		append using "s5.dta"
		append using "s6.dta"
		append using "s7.dta"
		append using "s8.dta"
		append using "s9.dta"
		append using "s10.dta"
	
		gen type="sp"
		gen label="a1"
		drop z p parm
		rename idstr month
		save "s_1_p.dta", replace
	
restore	

preserve

clear all
		
		
		use "s_3.dta"
		append using "s_2.dta"
		append using "s_1.dta"
		append using "s_3_p.dta"
		append using "s_2_p.dta"
		append using "s_1_p.dta"

		gen program="hu15"
		save "HU_2015_Coeff.dta", replace
restore


		

preserve

egen cmt=group(country month treathf)
egen cmlt=group(country month energy_label_eu treathf)

***HUNGARY, 2016, UNIT SALES, SUBSIDIZED, A+++

quietly reghdfe dlogunits i.presub3hf##ib1.treathf##ib4.label i.presub2hf##ib1.treathf##ib4.label i.presub1hf##ib1.treathf##ib4.label i.sub1hf##ib1.treathf##ib4.label i.sub2hf##ib1.treathf##ib4.label i.sub3hf##ib1.treathf##ib4.label i.sub4hf##ib1.treathf##ib4.label i.postsub1hf##ib1.treathf##ib4.label  mage mage2  , absorb(id2 cmlt) cluster(id)
est store subu3


    	nlcom _b[1.presub3hf], post
		est store s1
		parmest, format(estimate min95 max95) saving("s1.dta", replace) 	idstr(-3)	
		
est restore subu3		
		nlcom _b[1.presub3hf]+_b[1.presub2hf], post
		est store s2
		parmest, format(estimate min95 max95) saving("s2.dta", replace) 	idstr(-2)
    
est restore subu3		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf], post
		est store s3
		parmest, format(estimate min95 max95) saving("s3.dta", replace) 	idstr(-1)	

est restore subu3		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf], post
		est store s4
		parmest, format(estimate min95 max95) saving("s4.dta", replace) 	idstr(0)	
		
est restore subu3	
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf], post
		est store s5
		parmest, format(estimate min95 max95) saving("s5.dta", replace) 	idstr(1)			
		
est restore subu3		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf], post
		est store s6
		parmest, format(estimate min95 max95) saving("s6.dta", replace) 	idstr(2)			
	
est restore subu3		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf]+_b[1.sub4hf], post
		est store s7
		parmest, format(estimate min95 max95) saving("s7.dta", replace) 	idstr(3)	
	
est restore subu3		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf]+_b[1.sub4hf]+_b[1.postsub1hf], post
		est store s8
		parmest, format(estimate min95 max95) saving("s8.dta", replace) 	idstr(4)	
	
		clear all
		
		use "s1.dta"
		append using "s2.dta"
		append using "s3.dta"
		append using "s4.dta"
		append using "s5.dta"
		append using "s6.dta"
		append using "s7.dta"
		append using "s8.dta"

	
		gen type="s"
		gen label="a3"
		drop z p parm
		rename idstr month
		save "s_3.dta", replace
	
restore	

preserve

egen cmt=group(country month treathf)
egen cmlt=group(country month energy_label_eu treathf)

***HUNGARY, 2016, UNIT SALES, SUBSIDIZED, A++

quietly reghdfe dlogunits i.presub3hf##ib1.treathf##ib3.label i.presub2hf##ib1.treathf##ib3.label i.presub1hf##ib1.treathf##ib3.label i.sub1hf##ib1.treathf##ib3.label i.sub2hf##ib1.treathf##ib3.label i.sub3hf##ib1.treathf##ib3.label i.sub4hf##ib1.treathf##ib3.label i.postsub1hf##ib1.treathf##ib3.label  mage mage2  , absorb(id2 cmlt) cluster(id)	
est store subu2

   	nlcom _b[1.presub3hf], post
		est store s1
		parmest, format(estimate min95 max95) saving("s1.dta", replace) 	idstr(-3)	
		
est restore subu2		
		nlcom _b[1.presub3hf]+_b[1.presub2hf], post
		est store s2
		parmest, format(estimate min95 max95) saving("s2.dta", replace) 	idstr(-2)
    
est restore subu2		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf], post
		est store s3
		parmest, format(estimate min95 max95) saving("s3.dta", replace) 	idstr(-1)	

est restore subu2		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf], post
		est store s4
		parmest, format(estimate min95 max95) saving("s4.dta", replace) 	idstr(0)	
		
est restore subu2	
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf], post
		est store s5
		parmest, format(estimate min95 max95) saving("s5.dta", replace) 	idstr(1)			
		
est restore subu2	
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf], post
		est store s6
		parmest, format(estimate min95 max95) saving("s6.dta", replace) 	idstr(2)			
	
est restore subu2		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf]+_b[1.sub4hf], post
		est store s7
		parmest, format(estimate min95 max95) saving("s7.dta", replace) 	idstr(3)	
	
est restore subu2		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf]+_b[1.sub4hf]+_b[1.postsub1hf], post
		est store s8
		parmest, format(estimate min95 max95) saving("s8.dta", replace) 	idstr(4)	
	
		clear all
		
		use "s1.dta"
		append using "s2.dta"
		append using "s3.dta"
		append using "s4.dta"
		append using "s5.dta"
		append using "s6.dta"
		append using "s7.dta"
		append using "s8.dta"

	
		gen type="s"
		gen label="a2"
		drop z p parm
		rename idstr month
		save "s_2.dta", replace
	
restore	

preserve

egen cmt=group(country month treathf)
egen cmlt=group(country month energy_label_eu treathf)

***HUNGARY, 2016, UNIT SALES, SUBSIDIZED, A+

quietly reghdfe dlogunits i.presub3hf##ib1.treathf##ib2.label i.presub2hf##ib1.treathf##ib2.label i.presub1hf##ib1.treathf##ib2.label i.sub1hf##ib1.treathf##ib2.label i.sub2hf##ib1.treathf##ib2.label i.sub3hf##ib1.treathf##ib2.label i.sub4hf##ib1.treathf##ib2.label i.postsub1hf##ib1.treathf##ib2.label  mage mage2  , absorb(id2 cmlt) cluster(id)	
est store subu1

   	nlcom _b[1.presub3hf], post
		est store s1
		parmest, format(estimate min95 max95) saving("s1.dta", replace) 	idstr(-3)	
		
est restore subu1		
		nlcom _b[1.presub3hf]+_b[1.presub2hf], post
		est store s2
		parmest, format(estimate min95 max95) saving("s2.dta", replace) 	idstr(-2)
    
est restore subu1		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf], post
		est store s3
		parmest, format(estimate min95 max95) saving("s3.dta", replace) 	idstr(-1)	

est restore subu1		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf], post
		est store s4
		parmest, format(estimate min95 max95) saving("s4.dta", replace) 	idstr(0)	
		
est restore subu1	
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf], post
		est store s5
		parmest, format(estimate min95 max95) saving("s5.dta", replace) 	idstr(1)			
		
est restore subu1	
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf], post
		est store s6
		parmest, format(estimate min95 max95) saving("s6.dta", replace) 	idstr(2)			
	
est restore subu1		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf]+_b[1.sub4hf], post
		est store s7
		parmest, format(estimate min95 max95) saving("s7.dta", replace) 	idstr(3)	
	
est restore subu1		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf]+_b[1.sub4hf]+_b[1.postsub1hf], post
		est store s8
		parmest, format(estimate min95 max95) saving("s8.dta", replace) 	idstr(4)	
	
		clear all
		
		use "s1.dta"
		append using "s2.dta"
		append using "s3.dta"
		append using "s4.dta"
		append using "s5.dta"
		append using "s6.dta"
		append using "s7.dta"
		append using "s8.dta"

	
		gen type="s"
		gen label="a1"
		drop z p parm
		rename idstr month
		save "s_1.dta", replace
	
restore	

preserve

egen cmt=group(country month treathf)
egen cmlt=group(country month energy_label_eu treathf)

***HUNGARY, 2016, PRICES, SUBSIDIZED, A+++

quietly reghdfe dlogunits i.presub3hf##ib1.treathf##ib4.label i.presub2hf##ib1.treathf##ib4.label i.presub1hf##ib1.treathf##ib4.label i.sub1hf##ib1.treathf##ib4.label i.sub2hf##ib1.treathf##ib4.label i.sub3hf##ib1.treathf##ib4.label i.sub4hf##ib1.treathf##ib4.label i.postsub1hf##ib1.treathf##ib4.label  mage mage2  , absorb(id2 cmlt) cluster(id)
generate samplel=e(sample)
		

quietly reghdfe dlogprice i.presub3hf##ib1.treathf##ib4.label i.presub2hf##ib1.treathf##ib4.label i.presub1hf##ib1.treathf##ib4.label i.sub1hf##ib1.treathf##ib4.label i.sub2hf##ib1.treathf##ib4.label i.sub3hf##ib1.treathf##ib4.label i.sub4hf##ib1.treathf##ib4.label i.postsub1hf##ib1.treathf##ib4.label  mage mage2  if  samplel, absorb(id2 cmlt) cluster(id)
est store subu3


    	nlcom _b[1.presub3hf], post
		est store s1
		parmest, format(estimate min95 max95) saving("s1.dta", replace) 	idstr(-3)	
		
est restore subu3		
		nlcom _b[1.presub3hf]+_b[1.presub2hf], post
		est store s2
		parmest, format(estimate min95 max95) saving("s2.dta", replace) 	idstr(-2)
    
est restore subu3		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf], post
		est store s3
		parmest, format(estimate min95 max95) saving("s3.dta", replace) 	idstr(-1)	

est restore subu3		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf], post
		est store s4
		parmest, format(estimate min95 max95) saving("s4.dta", replace) 	idstr(0)	
		
est restore subu3	
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf], post
		est store s5
		parmest, format(estimate min95 max95) saving("s5.dta", replace) 	idstr(1)			
		
est restore subu3		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf], post
		est store s6
		parmest, format(estimate min95 max95) saving("s6.dta", replace) 	idstr(2)			
	
est restore subu3		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf]+_b[1.sub4hf], post
		est store s7
		parmest, format(estimate min95 max95) saving("s7.dta", replace) 	idstr(3)	
	
est restore subu3		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf]+_b[1.sub4hf]+_b[1.postsub1hf], post
		est store s8
		parmest, format(estimate min95 max95) saving("s8.dta", replace) 	idstr(4)	
	
		clear all
		
		use "s1.dta"
		append using "s2.dta"
		append using "s3.dta"
		append using "s4.dta"
		append using "s5.dta"
		append using "s6.dta"
		append using "s7.dta"
		append using "s8.dta"

	
		gen type="sp"
		gen label="a3"
		drop z p parm
		rename idstr month
		save "s_3_p.dta", replace
	
restore	

preserve

egen cmt=group(country month treathf)
egen cmlt=group(country month energy_label_eu treathf)

***HUNGARY, 2016, PRICES, SUBSIDIZED, A++

quietly reghdfe dlogunits i.presub3hf##ib1.treathf##ib4.label i.presub2hf##ib1.treathf##ib4.label i.presub1hf##ib1.treathf##ib4.label i.sub1hf##ib1.treathf##ib4.label i.sub2hf##ib1.treathf##ib4.label i.sub3hf##ib1.treathf##ib4.label i.sub4hf##ib1.treathf##ib4.label i.postsub1hf##ib1.treathf##ib4.label  mage mage2  , absorb(id2 cmlt) cluster(id)
generate samplel=e(sample)

quietly reghdfe dlogprice i.presub3hf##ib1.treathf##ib3.label i.presub2hf##ib1.treathf##ib3.label i.presub1hf##ib1.treathf##ib3.label i.sub1hf##ib1.treathf##ib3.label i.sub2hf##ib1.treathf##ib3.label i.sub3hf##ib1.treathf##ib3.label i.sub4hf##ib1.treathf##ib3.label i.postsub1hf##ib1.treathf##ib3.label  mage mage2  if  samplel, absorb(id2 cmlt) cluster(id)	
est store subu2

   	nlcom _b[1.presub3hf], post
		est store s1
		parmest, format(estimate min95 max95) saving("s1.dta", replace) 	idstr(-3)	
		
est restore subu2		
		nlcom _b[1.presub3hf]+_b[1.presub2hf], post
		est store s2
		parmest, format(estimate min95 max95) saving("s2.dta", replace) 	idstr(-2)
    
est restore subu2		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf], post
		est store s3
		parmest, format(estimate min95 max95) saving("s3.dta", replace) 	idstr(-1)	

est restore subu2		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf], post
		est store s4
		parmest, format(estimate min95 max95) saving("s4.dta", replace) 	idstr(0)	
		
est restore subu2	
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf], post
		est store s5
		parmest, format(estimate min95 max95) saving("s5.dta", replace) 	idstr(1)			
		
est restore subu2	
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf], post
		est store s6
		parmest, format(estimate min95 max95) saving("s6.dta", replace) 	idstr(2)			
	
est restore subu2		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf]+_b[1.sub4hf], post
		est store s7
		parmest, format(estimate min95 max95) saving("s7.dta", replace) 	idstr(3)	
	
est restore subu2		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf]+_b[1.sub4hf]+_b[1.postsub1hf], post
		est store s8
		parmest, format(estimate min95 max95) saving("s8.dta", replace) 	idstr(4)	
	
		clear all
		
		use "s1.dta"
		append using "s2.dta"
		append using "s3.dta"
		append using "s4.dta"
		append using "s5.dta"
		append using "s6.dta"
		append using "s7.dta"
		append using "s8.dta"

	
		gen type="sp"
		gen label="a2"
		drop z p parm
		rename idstr month
		save "s_2_p.dta", replace
	
restore	

preserve

egen cmt=group(country month treathf)
egen cmlt=group(country month energy_label_eu treathf)

***HUNGARY, 2016, PRICES, SUBSIDIZED, A+

quietly reghdfe dlogunits i.presub3hf##ib1.treathf##ib4.label i.presub2hf##ib1.treathf##ib4.label i.presub1hf##ib1.treathf##ib4.label i.sub1hf##ib1.treathf##ib4.label i.sub2hf##ib1.treathf##ib4.label i.sub3hf##ib1.treathf##ib4.label i.sub4hf##ib1.treathf##ib4.label i.postsub1hf##ib1.treathf##ib4.label  mage mage2  , absorb(id2 cmlt) cluster(id)
generate samplel=e(sample)

quietly reghdfe dlogprice i.presub3hf##ib1.treathf##ib2.label i.presub2hf##ib1.treathf##ib2.label i.presub1hf##ib1.treathf##ib2.label i.sub1hf##ib1.treathf##ib2.label i.sub2hf##ib1.treathf##ib2.label i.sub3hf##ib1.treathf##ib2.label i.sub4hf##ib1.treathf##ib2.label i.postsub1hf##ib1.treathf##ib2.label  mage mage2  if  samplel, absorb(id2 cmlt) cluster(id)
est store subu1

   	nlcom _b[1.presub3hf], post
		est store s1
		parmest, format(estimate min95 max95) saving("s1.dta", replace) 	idstr(-3)	
		
est restore subu1		
		nlcom _b[1.presub3hf]+_b[1.presub2hf], post
		est store s2
		parmest, format(estimate min95 max95) saving("s2.dta", replace) 	idstr(-2)
    
est restore subu1		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf], post
		est store s3
		parmest, format(estimate min95 max95) saving("s3.dta", replace) 	idstr(-1)	

est restore subu1		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf], post
		est store s4
		parmest, format(estimate min95 max95) saving("s4.dta", replace) 	idstr(0)	
		
est restore subu1	
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf], post
		est store s5
		parmest, format(estimate min95 max95) saving("s5.dta", replace) 	idstr(1)			
		
est restore subu1	
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf], post
		est store s6
		parmest, format(estimate min95 max95) saving("s6.dta", replace) 	idstr(2)			
	
est restore subu1		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf]+_b[1.sub4hf], post
		est store s7
		parmest, format(estimate min95 max95) saving("s7.dta", replace) 	idstr(3)	
	
est restore subu1		
		nlcom _b[1.presub3hf]+_b[1.presub2hf]+_b[1.presub1hf]+_b[1.sub1hf]+_b[1.sub2hf]+_b[1.sub3hf]+_b[1.sub4hf]+_b[1.postsub1hf], post
		est store s8
		parmest, format(estimate min95 max95) saving("s8.dta", replace) 	idstr(4)	
	
		clear all
		
		use "s1.dta"
		append using "s2.dta"
		append using "s3.dta"
		append using "s4.dta"
		append using "s5.dta"
		append using "s6.dta"
		append using "s7.dta"
		append using "s8.dta"

	
		gen type="sp"
		gen label="a1"
		drop z p parm
		rename idstr month
		save "s_1_p.dta", replace
	
restore	


preserve

clear all
		
		
		use "s_3.dta"
		append using "s_2.dta"
		append using "s_1.dta"
		append using "s_3_p.dta"
		append using "s_2_p.dta"
		append using "s_1_p.dta"

		gen program="hu16"
		save "HU_2016_Coeff.dta", replace
restore		
		


clear all
		
		use "HU_2015_Coeff.dta"
		append using "HU_2016_Coeff.dta"
		
		
		save "Estimates_for_plots_label.dta", replace


*log close
